#!/usr/bin/env python
#coding=utf-8
# author:wade
# contact: 317909531@qq.com
# datetime:2020/4/4 13:45
from rest_framework import serializers
# from myclass import models
"""
文件说明：对数据库模型的基本序列化表格，展示所有的1级字段信息
"""

# 学校序列化
class B_MS_COLLEGE_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_COLLEGE
        fields = '__all__'


# 年级序列化
class B_MS_GRADE_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_GRADE
        fields = '__all__'

# 班级序列化
class B_MS_CLASS_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_CLASS
        fields = '__all__'


# 学生序列化
class B_MS_STUDENT_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_STUDENT
        fields = '__all__'
        # depth =2

# 积分序列化
class B_MS_SCORE_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_SCORE
        fields = '__all__'

# 积分策略序列化
class B_MS_SCORE_STYLE_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_SCORE_STYLE
        fields = '__all__'

# 积分分类序列化
class B_MS_SCORE_BOARD_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_SCORE_BOARD
        fields = '__all__'

# 等级序列化
class B_MS_LEVEL_serializers(serializers.ModelSerializer):
    # ms_grades = serializers.StringRelatedField(many=True)  # 一找多，用_str_字段展示关系
    # ms_grades = serializers.PrimaryKeyRelatedField(many=True,read_only=True)  # 一找多，用关系表的主键展示关系
    # ms_grades = serializers.SlugRelatedField(many=True,read_only=True,slug_field='STATUE') # 一找多，用关系表的内容属性展示关系
    class Meta:
        model = models.MS_LEVEL
        fields = '__all__'



